/** 
 * Copyright (C) 2012 Foxit Corporation.
 * All Rights Reserved.
 *
 * The following code is copyrighted and contains proprietary information and trade secrets of Foxit Corporation. 
 * You can only redistribute files listed below to customers of your application, under a written SDK license agreement with Foxit. 
 * You cannot distribute any part of the SDK to general public, even with a SDK license agreement. 
 * Without SDK license agreement, you cannot redistribute anything.
 *
 * @file	fpdfdrm.h
 * @brief	Header file for the PDF Digital Rights Management module.<br>
 * @details	The PDF Digital Rights Management module offers methods to do some operations on Digital Rights Management.
 *			<br>
 *			Following the specification of PDF, users can retrieve the encryption information in a encrypted PDF.
 *			as well as add, or delete encryption information by using these methods.
 *			User also can use this module to encrypt a PDF or decrypt a encrypted PDF by Foxit PDF DRM handle.
 * @note	If you want to purchase Foxit PDF SDK license and use ANY of the following functions, please
 *			request for enabling Digital Rights Management module explicitly. 
 */

/** 
 * @addtogroup FGSPDFDRM PDF DRM
 * @brief Methods in this module are included in fpdfdrm.h
 */

/** @{*/

#ifndef __FGSPDFDRM__
#define __FGSPDFDRM__

#include "fpdfbase.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Judge a pdf document whether is encrypted by Foxit DRM.
 *
 * @param[in] document		Reference to a PDF document.
 * @param[in] subFilter		A string specifying the sub filter.
 *
 * @return	A boolean object receives that the pdf document whether is encrypted by Foxit DRM.
 *
 */
Boolean FGSPDFDrmIsFoxitDRM(FGSPDFDocumentRef document, CFStringRef subFilter);

/************************************************************************/
/*						Encrypt parameters                              */
/************************************************************************/

/**
 * @brief Get Reference to the encrypt params.
 *
 * @param[in] document		Reference to a PDF document.
 *
 * @return	The returned encrypt params reference.
 *
 */
FGSPDFEncryptParamsRef FGSPDFDrmGetEncryptParams(FGSPDFDocumentRef document);

/**
 * @brief Get the modified Encrypt params reference.
 *
 * @details The returned reference can be used to modify the encrypt params.
 *
 * @param[in] document		Reference to a PDF document.
 *
 * @return	The returned encrypt params reference.
 *
 */
FGSPDFEncryptParamsRef FGSPDFDrmGetModifiedEncryptParams(FGSPDFDocumentRef document);

/**
 * @brief Release a encrypt params reference.
 *
 * @param[in] encryptParams		Reference to the encrypt params.
 *
 * @return	::kFGSErrorSuccess means releasing encrypt params successfully.<br>
 *			For more definitions please see enum definitions <b>FGSErrorRet</b>.
 */
FGSErrorRet	FGSPDFDrmReleaseEncryptParams(FGSPDFEncryptParamsRef encryptParams);

/**
 * @brief  Enum Definitions for pdf encrypt params item 
 */
enum {
	/**  Filter, byte string */
    kFGSPDFEncryptParamsFilter      = 1,
	/**  SubFilter, byte string */
    kFGSPDFEncryptParamsSubFilter   = 2,
	/**  Issuer, wide string */
    kFGSPDFEncryptParamsIssuer      = 3,
	/**  Creator, wide string */
    kFGSPDFEncryptParamsCreator     = 4,
	/**  Flow code, wide string */
    kFGSPDFEncryptParamsFileid      = 5,
	/**  Order, wide string */
    kFGSPDFEncryptParamsFlowCode    = 6,
	/**  Filter, wide string */
    kFGSPDFEncryptParamsOrder       = 7,
	/**  User, wide string */
    kFGSPDFEncryptParamsUser        = 8,
	/**  Service URL, wide string */
    kFGSPDFEncryptParamsServiceurl  = 9,
};
/** @brief Alias of enumeration for pdf encrypt params item. */
typedef UInt32 FGSPDFEncryptParamsItem;

/**
 * @brief Get the byte string item of the encrypt params.
 *
 * @param[in] encryptParams			Reference to the encrypt params.
 * @param[in] item					The item number of the params.
 *
 * @return	The item string.
 */
CFStringRef	FGSPDFDrmCopyEncryptParamsItemString(FGSPDFEncryptParamsRef encryptParams, FGSPDFEncryptParamsItem item);

/**
 * @brief Get the wide string key of the encrypt params.
 *
 * @param[in] encryptParams			Reference to the encrypt params.
 * @param[in] key					The key string specified which to get.
 *
 * @return	The key string.
 */
CFStringRef	FGSPDFDrmCopyEncryptKeyString(FGSPDFEncryptParamsRef encryptParams, CFStringRef key);

/**
 * @brief Set the string item of the encrypt params.
 *
 * @param[in] encryptParams			Reference to the encrypt params.
 * @param[in] item					The item number of the params
 * @param[in] value					The string set to the item.
 *
 * @return	::kFGSErrorSuccess means successfully.<br>
 *			For more definitions please see enum definitions <b>FGSErrorRet</b>.
 */
FGSErrorRet	FGSPDFDrmSetEncryptParamsItemString(FGSPDFEncryptParamsRef encryptParams, FGSPDFEncryptParamsItem item, CFStringRef value);

/**
 * @brief Set the string key of the encrypt params.
 *
 * @param[in] encryptParams			Reference to the encrypt params.
 * @param[in] key					The key string specified which to set.
 * @param[in] str					The key value string.
 *
 * @return	::kFGSErrorSuccess means successfully.<br>
 *			For more definitions please see enum definitions <b>FGSErrorRet</b>.
 */
FGSErrorRet	FGSPDFDrmSetEncryptKeyString(FGSPDFEncryptParamsRef encryptParams, CFStringRef key, CFStringRef value);

/**
 * @brief Remove the item of the encrypt params.
 *
 * @param[in] encryptParams			Reference to the encrypt params.
 * @param[in] item					The item of the params. 
 *
 * @return	::kFGSErrorSuccess means successfully.<br>
 *			For more definitions please see enum definitions <b>FGSErrorRet</b>.
 */
FGSErrorRet	FGSPDFDrmRemoveEncryptParamsItem(FGSPDFEncryptParamsRef encryptParams, SInt32 item);

/**
 * @brief Remove the key of the encrypt params.
 *
 * @param[in] encryptParams			Reference to the encrypt params.
 * @param[in] key					The key string specified which to remove.
 *
 * @return	::kFGSErrorSuccess means successfully.<br>
 *			For more definitions please see enum definitions <b>FGSErrorRet</b>.
 */
FGSErrorRet	FGSPDFRemoveEncryptParamsKey(FGSPDFEncryptParamsRef encryptParams, CFStringRef key);

#ifdef __cplusplus
};
#endif

#endif
//__FGSPDFDRM__
/**@}*/
